home *** CD-ROM | disk | FTP | other *** search
Text File | 2004-01-24 | 31.0 KB | 1,163 lines |
- ; Blobz v1.0
- ; (c) Graham Humphrey 2003-2004
- ; STARTED: Wed Dec 24 2003 5:19 PM
- ; FINISHED: Fri Jan 23 2004 5:03 PM
- ;
- ;BLOBZ SHAPE FILES
- ;=================
- ;
- ;Contents of 'title.shp':
- ;
- ;0 = Title Logo
- ;1 = Start Game
- ;2 = Load Game
- ;3 = High Scores
- ;4 = Quit
- ;5 = Pointer
- ;
- ;Contents of 'ar.shp':
- ;
- ;0 = AR Logo
- ;1 = Presents
- ;
- ;Contents of 'world1.shp':
- ;
- ;0 = Normal
- ;1 = Gem
- ;2 = Key
- ;3 = Extra Life
- ;4 = 100 Points
- ;5 = Health
- ;6 = Start
- ;7 = Door (Vertical)
- ;8 = Door (Horizontal)
- ;9 = Death
- ;10-11 = Exit
- ;12 = Ice
- ;13-16 = Arrows (Right, Up, Left, Down)
- ;17-31 = Wall
- ;32-47 = Enemies
- ;
- ;Contents of 'objects.shp':
- ;
- ;0 = Gem
- ;1 = Key
- ;2 = Extra Life
- ;3 = 100 Points
- ;4 = Health
- ;5 = Door (Horizontal)
- ;6 = Door (Vertical)
- ;
- ;Contents of 'player.shp' and the 'enemy.shp' files:
- ;
- ;0 = None
- ;1 = Right
- ;2 = Up
- ;3 = Left
- ;4 = Down
- ;5 = Up-Left
- ;6 = Up-Right
- ;7 = Down-Left
- ;8 = Down-Right
-
- WBStartup
- SetErr:End:End SetErr
-
- .constants
-
- #mapwidth=40 ; set up constants
- #mapheight=32
- #blockwidth=16
- #blockheight=16
- #shapeoffset=0
- #maxdepth=5
- #mapnull=1
- #datasize=2
- #maxlevels=50
- cheat=0
- complete=0
-
- Dim highname$(9)
- Dim highpoints.w(9)
-
- For n=0 To 9
- MaxLen highname$(n)=20
- Next n
-
- .begin
-
- level=1:lives=3:health=3:score=0:gems=0:keys=0:done=0:sav=0
-
- NEWTYPE .block ; define newtypes for game elements
- shap.w:x:y
- End NEWTYPE
-
- NEWTYPE .stuff
- shap.w:x:y:p:typ:sp:ex:ey:l
- End NEWTYPE
-
- Dim List blk.block(#mapwidth*#mapheight) ; use list array for map tiles
- Dim List stf.stuff(#mapwidth*#mapheight)
-
- n=0
- count=0
- db=0
- x=120:y=160
-
- ;This code generated by the RED Map Editor v2.5, and edited by me
- ;Draws the map onto the given bitmap
- ;address=address of map file
- ;xpos and ypos of coordinates to draw from
- ;bitmap is the bitmap to render to
-
- Statement DrawMyMap{address.l,xpos.w,ypos.w,bitm.b}
- SHARED blk.block(),stf.stuff(),level,lives,health,gems,keys,px,py,sx,sy
- bitmaddr.l=Addr BitMap(bitm)
- bitm_bwidth=(Peek.w(bitmaddr)ASL 3)/#blockwidth
- bitm_bheight=Peek.w(bitmaddr+2)/#blockheight
- If bitm_bwidth>#mapwidth Then bitm_bwidth=#mapwidth
- If bitm_bheight>#mapheight Then bitm_bheight=#mapheight
-
- If xpos+bitm_bwidth>=#mapwidth Then xpos=#mapwidth-bitm_bwidth
- If ypos+bitm_bheight>=#mapheight Then ypos=#mapheight-bitm_bheight
- If xpos<0 Then xpos=0
- If ypos<0 Then ypos=0
-
- address+(xpos*#datasize)+(ypos*#mapwidth*#datasize)
- Use BitMap bitm
- x.w=8 : y.w=8 ; Pixel position of top-left corner of map
- For yloop.w=0 To bitm_bheight-1
- ad.l=address
- For xloop.w=0 To bitm_bwidth-1
- shap.w=#shapeoffset+Peek.w(ad)-#mapnull
- ad+2
- If shap=1 Then gems=gems+1 ; find no. of objects on a level
- If shap=0 OR shap=1 OR shap=2 OR shap=3 OR shap=4 OR shap=5 Then Blit 0,x,y
- If shap=>6 Then Blit shap,x,y
- If shap=6 Then sx=x:sy=y:px=sx:py=sy
- If shap=>32 Then Blit 0,x,y
- If shap=1 OR shap=2 OR shap=3 OR shap=4 OR shap=5 OR shap=6 OR shap=7 OR shap=8
- If AddItem(blk()) ; store tiles in list array
- USEPATH blk()
- \shap=shap:\x=x:\y=y
- EndIf
- EndIf
- If shap=>9 AND shap<=31
- If AddItem(stf())
- USEPATH stf()
- \shap=shap:\x=x:\y=y
- EndIf
- EndIf
- If shap=>32
- If AddItem(stf())
- USEPATH stf()
- \shap=shap:\ex=x:\ey=y
- EndIf
- EndIf
- x+#blockwidth
- Next xloop
- x=8
- y+#blockheight
- address+(#mapwidth*#datasize)
- Next yloop
- End Statement
-
- Statement DrawMyMap2{address.l,xpos.w,ypos.w,bitm.b}
- bitmaddr.l=Addr BitMap(bitm)
- bitm_bwidth=(Peek.w(bitmaddr)ASL 3)/#blockwidth
- bitm_bheight=Peek.w(bitmaddr+2)/#blockheight
- If bitm_bwidth>#mapwidth Then bitm_bwidth=#mapwidth
- If bitm_bheight>#mapheight Then bitm_bheight=#mapheight
-
- If xpos+bitm_bwidth>=#mapwidth Then xpos=#mapwidth-bitm_bwidth
- If ypos+bitm_bheight>=#mapheight Then ypos=#mapheight-bitm_bheight
- If xpos<0 Then xpos=0
- If ypos<0 Then ypos=0
-
- address+(xpos*#datasize)+(ypos*#mapwidth*#datasize)
- Use BitMap bitm
- x.w=8 : y.w=8 ; Pixel position of top-left corner of map
- For yloop.w=0 To bitm_bheight-1
- ad.l=address
- For xloop.w=0 To bitm_bwidth-1
- shap.w=#shapeoffset+Peek.w(ad)-#mapnull
- ad+2
- If shap=0 OR shap=1 OR shap=2 OR shap=3 OR shap=4 OR shap=5 Then Blit 0,x,y
- If shap=>6 Then Blit shap,x,y
- If shap=>32 Then Blit 0,x,y
- x+#blockwidth
- Next xloop
- x=8
- y+#blockheight
- address+(#mapwidth*#datasize)
- Next yloop
- End Statement
-
- LoadShapes 0,"Gfx/ar.shp"
- LoadShapes 2,"Gfx/title.shp"
-
- LoadPalette 0,"Gfx/game.pal"
-
- LoadMedModule 0,"Music/title.med"
-
- LoadBlitzFont 0,"2001.font"
-
- suc=OpenFile(0,"Data/highscores")
- If suc=0
- For n=0 To 9
- highname$(n)="Graham"
- highpoints(n)=0
- Next n
- EndIf
- If suc=-1
- Fields 0,highname$(0)
- Fields 0,highname$(1)
- Fields 0,highname$(2)
- Fields 0,highname$(3)
- Fields 0,highname$(4)
- Fields 0,highname$(5)
- Fields 0,highname$(6)
- Fields 0,highname$(7)
- Fields 0,highname$(8)
- Fields 0,highname$(9)
- Fields 0,highpoints(0)
- Fields 0,highpoints(1)
- Fields 0,highpoints(2)
- Fields 0,highpoints(3)
- Fields 0,highpoints(4)
- Fields 0,highpoints(5)
- Fields 0,highpoints(6)
- Fields 0,highpoints(7)
- Fields 0,highpoints(8)
- Fields 0,highpoints(9)
- Get 0,0
- CloseFile 0
- EndIf
-
- For n=0 To 9
- If highname$(n)="" Then highname$(n)="Graham"
- Next n
-
- For n=2 To 7
- Handle n,0,0
- Next n
-
- BitMap 0,320,256,5 : Buffer 0,16384
- BitMap 1,320,256,5 : Buffer 1,16384
- BitMap 2,320,256,5
- BitMap 3,320,256,5
- BitMap 4,320,256,5
- BitMap 5,320,256,5
-
- InitCopList 0,$00005
-
- Use BitMap 0:Blit 2,20,4:Blit 3,130,160:Blit 4,130,180:Blit 6,130,200
- Use BitMap 1:Blit 2,20,4:Blit 3,130,160:Blit 4,130,180:Blit 6,130,200
- Use BitMap 2:Blit 0,23,112
- Use BitMap 3:Blit 1,124,119
-
- VWait 100
-
- BLITZ:BlitzKeys On:BitMapOutput 2:BitMapOutput 3:Colour 1
- CreateDisplay 0:DisplayPalette 0,0
- StartMedModule 0
-
- Repeat
- VWait
- PlayMed
- DisplayBitMap 0,2
- count=count+1
- Until count>200 OR Joyb(1) OR RawStatus($40)
-
- count=0:DisplayBitMap 0,4:Use BitMap 2:Cls
- Repeat:VWait:PlayMed:count=count+1:Until count>100
-
- count=0
-
- Repeat
- VWait
- PlayMed
- DisplayBitMap 0,3
- count=count+1
- Until count>200 OR Joyb(1) OR RawStatus($40)
-
- count=0:DisplayBitMap 0,4:Use BitMap 3:Cls
- Repeat:VWait:PlayMed:count=count+1:Until count>100
-
- VWait
- ;PlayMed
-
- count=0
-
- BitMapOutput 2:Use BitMap 2:Colour 1
- Locate 0,0:NPrint " HIGH SCORES "
- For n=0 To 9
- Locate 0,n+2:Format "######0":NPrint highname$(n):Locate 33,n+2:NPrint highpoints(n)
- Next n
-
- BitMapOutput 3:Use BitMap 3:Colour 1
- Locate 0,0 :NPrint " ALTERNATE REALITIES "
- Locate 0,1 :NPrint " presents "
- Locate 0,2 :NPrint " BLOBZ "
- Locate 0,3 :NPrint " (c) 2003-04 Alternate Realities "
- Locate 0,14:NPrint "Programming and Gfx - Graham Humphrey"
- Locate 0,15:NPrint "Level Design - Graham and Simon Humphrey"
- Locate 0,16:NPrint "Sfx and Music - taken from various PD"
- Locate 0,17:NPrint " games"
- Locate 0,28:NPrint " Written in BLITZ BASIC 2.1 "
- Locate 0,29:NPrint " This game is freeware "
- Locate 0,31:NPrint " See 'Blobz.guide' for instructions "
-
- .maintitle
-
- Repeat
-
- VWait
- PlayMed
- DisplayBitMap 0,0:db=1-db:Use BitMap db:UnBuffer db
-
- jy=Joyy(1)
- jb=Joyb(1)
-
- If RawStatus($4c) Then jy=-1
- If RawStatus($4d) Then jy=1
- If RawStatus($40) Then jb=1
-
- If jy=-1 AND y>160 Then y=y-20
- If jy=1 AND y<200 Then y=y+20
-
- If jb<>0 AND y=160 ; start the game!
- VWait
- DisplayBitMap 0,4
- Use BitMap 0:Cls:Use BitMap 1:Cls
- UnBuffer 0:UnBuffer 1:UnBuffer db
- Free BitMap 0:Free BitMap 1:Free BitMap 2:Free BitMap 3
- For v=64 To 0 Step -0.5
- VWait
- PlayMed
- SetMedVolume v
- Next v
- StopMed
- Goto game
- EndIf
-
- If jb<>0 AND y=180 ; load game
- DisplayBitMap 0,4:Format "0"
- Use BitMap 4:BitMapOutput 4:Colour 1:BlitzKeys On:done=0
- Locate 0,15:NPrint " GAME NUMBER? 1 to 9 "
- Repeat
- VWait
- PlayMed
- If RawStatus($01) Then sav=1:Gosub loadgame
- If RawStatus($02) Then sav=2:Gosub loadgame
- If RawStatus($03) Then sav=3:Gosub loadgame
- If RawStatus($04) Then sav=4:Gosub loadgame
- If RawStatus($05) Then sav=5:Gosub loadgame
- If RawStatus($06) Then sav=6:Gosub loadgame
- If RawStatus($07) Then sav=7:Gosub loadgame
- If RawStatus($08) Then sav=8:Gosub loadgame
- If RawStatus($09) Then sav=9:Gosub loadgame
- Until done=1
- Use BitMap 0:Cls:Use BitMap 1:Cls
- UnBuffer 0:UnBuffer 1:UnBuffer db
- Free BitMap 0:Free BitMap 1:Free BitMap 2:Free BitMap 3
- Use BitMap 4:Cls
- For v=64 To 0 Step -0.5
- VWait
- PlayMed
- SetMedVolume v
- Next v
- StopMed
- level=levela
- Goto game
- EndIf
-
- If jb<>0 AND y=200 ; quit
- For v=64 To 0 Step -0.5
- VWait
- PlayMed
- SetMedVolume v
- Next v
- StopMed
- Goto cleanup
- EndIf
-
- Buffer db,16384
- BBlit db,7,x,y
-
- count=count+1
- If count>1000 Then Gosub highscores
- If count>1500 Then Gosub info
-
- Forever
-
- .highscores
-
- Repeat
- VWait
- PlayMed
- DisplayBitMap 0,2
- count=count+1
- If Joyb(1)<>0 OR RawStatus($40) Then count=1500
- Until count>1500
-
- Return
-
- .info
-
- Repeat
- VWait
- PlayMed
- DisplayBitMap 0,3
- count=count+1
- If Joyb(1)<>0 OR RawStatus($40) Then count=2000
- Until count>2000
- count=0
-
- Return
-
- .game
-
- QAMIGA:Format "0":done=0:sav=0
- If level>9 Then Format "00"
- InitCopList 0,96,214,$00015,8,32,0
- InitCopList 1,44,50,$00005,8,32,0
- InitCopList 2,$00005
-
- BitMap 2,320,50,#maxdepth
- BitMap 3,320,256,5
- BitMap 4,320,256,5
-
- LoadShape 101,"Gfx/loading.iff"
- LoadPalette 0,"Gfx/game.pal"
-
- Blit 101,120,90
- BLITZ
- CreateDisplay 2:DisplayBitMap 2,4:DisplayPalette 2,0
-
- QAMIGA
- ; load in graphics
- LoadShapes 48,56,"Gfx/player.shp" :For n=48 To 56:MidHandle n:Next n
- LoadShapes 57,65,"Gfx/enemy1.shp" :For n=57 To 65:MidHandle n:Next n
- LoadShapes 66,74,"Gfx/enemy2.shp" :For n=66 To 74:MidHandle n:Next n
- LoadShapes 75,83,"Gfx/enemy3.shp" :For n=75 To 83:MidHandle n:Next n
- LoadShapes 84,92,"Gfx/enemy4.shp" :For n=84 To 92:MidHandle n:Next n
- LoadShapes 93,99,"Gfx/objects.shp":For n=93 To 99:MidHandle n:Next n
- LoadShape 100,"Gfx/panel.iff":LoadShape 102,"Gfx/gameover.iff"
-
- ; load in sounds
- LoadSound 0,"Sfx/comp.snd"
- LoadSound 1,"Sfx/die.snd"
- LoadSound 2,"Sfx/gameover.snd"
- LoadSound 3,"Sfx/gem.snd"
- LoadSound 4,"Sfx/health.snd"
- LoadSound 5,"Sfx/hit.snd"
- LoadSound 6,"Sfx/key.snd"
- LoadSound 7,"Sfx/life.snd"
- LoadSound 8,"Sfx/pts.snd"
- LoadSound 9,"Sfx/door.snd"
- LoadSound 10,"Sfx/warning.snd"
- LoadSound 11,"Sfx/hiscore.snd"
-
- ; load font
- LoadBlitzFont 0,"2001.font"
-
- .setup
-
- done=0
-
- If level=>1 Then shapefile$="Gfx/world1.shp":LoadShape 93,"Gfx/gem1.iff":MidHandle 93
- If level=>11 Then shapefile$="Gfx/world2.shp":LoadShape 93,"Gfx/gem2.iff":MidHandle 93
- If level=>21 Then shapefile$="Gfx/world3.shp":LoadShape 93,"Gfx/gem3.iff":MidHandle 93
- If level=>31
- shapefile$="Gfx/world4.shp"
- LoadShape 93,"Gfx/gem4.iff":MidHandle 93
- LoadShape 94,"Gfx/key4.iff":MidHandle 94
- LoadShape 97,"Gfx/heart4.iff":MidHandle 97
- EndIf
- If level=>41
- shapefile$="Gfx/world5.shp"
- LoadShape 93,"Gfx/gem5.iff":MidHandle 93
- LoadShape 94,"Gfx/key.iff":MidHandle 94
- LoadShape 97,"Gfx/heart.iff":MidHandle 97
- EndIf
-
- BitMap 0,640,512,#maxdepth : Buffer 0,16384
- BitMap 1,640,512,#maxdepth : Buffer 1,16384
-
- mapfile$="Level/"+Str$(level)
- palettefile$="Gfx/game.pal"
-
- DEFTYPE.w
-
- ; Can we open our map file?
- suc=OpenFile(0,mapfile$)
- size=Lof(0)
- If suc=0 OR size=0 Then End
-
- ; Yup - so get some memory to store it in
- mapad.l=AllocMem(size,1)
- If mapad=0 Then End
- ReadMem 0,mapad,size ; Read in map
- CloseFile 0
-
- ; Load those shapes in
- If Exists(shapefile$)
- LoadShapes 0,47,shapefile$:For n=0 To 47:MidHandle n:Next n
- Else
- End
- EndIf
-
- ; Load the palette in if we've got one
- If Exists(palettefile$) AND palettefile$<>""
- LoadPalette 0,palettefile$
- EndIf
-
- ; Draw map
- Use BitMap 0
- Cls
- DrawMyMap{mapad,0,0,0}
- Use BitMap 1
- Cls
- DrawMyMap2{mapad,0,0,1}
-
- db=0:p=48:scrollx=0:scrolly=0:liveslost=0:healthlost=0:gemcoll=0:timelost=0
-
- If level=6 Then gems=gems-1
- If level=13 Then gems=gems-1
- If level=14 Then gems=gems-1
- If level=28 Then gems=gems-1
- If level=34 Then gems=gems-1
- If level=35 Then gems=gems-1
- If level=36 Then gems=gems-1
- If level=42 Then gems=gems-1
- If level=45 Then gems=gems-1
- If level=47 Then gems=gems-1
-
- If FirstItem(stf())=-1 ; sort out enemy's position
- USEPATH stf()
- While NextItem(stf())=-1
- If \shap=32 Then \typ=1:\p=1:\shap=60:\sp=2:\l=1 ; red left
- If \shap=33 Then \typ=2:\p=1:\shap=69:\sp=4:\l=3 ; green left
- If \shap=34 Then \typ=3:\p=1:\shap=78:\sp=8:\l=5 ; yellow left
- If \shap=35 Then \typ=4:\p=1:\shap=87:\sp=16:\l=7 ; blue left
- If \shap=36 Then \typ=4:\p=2:\shap=85:\sp=16:\l=7 ; blue right
- If \shap=37 Then \typ=3:\p=2:\shap=76:\sp=8:\l=5 ; yellow right
- If \shap=38 Then \typ=2:\p=2:\shap=67:\sp=4:\l=3 ; green right
- If \shap=39 Then \typ=1:\p=2:\shap=58:\sp=2:\l=1 ; red right
- If \shap=40 Then \typ=1:\p=3:\shap=61:\sp=2:\l=2 ; red down
- If \shap=41 Then \typ=2:\p=3:\shap=70:\sp=4:\l=4 ; green down
- If \shap=42 Then \typ=3:\p=3:\shap=79:\sp=8:\l=6 ; yellow down
- If \shap=43 Then \typ=4:\p=3:\shap=88:\sp=16:\l=8 ; blue down
- If \shap=44 Then \typ=4:\p=4:\shap=86:\sp=16:\l=8 ; blue up
- If \shap=45 Then \typ=3:\p=4:\shap=77:\sp=8:\l=6 ; yellow up
- If \shap=46 Then \typ=2:\p=4:\shap=68:\sp=4:\l=4 ; green up
- If \shap=47 Then \typ=1:\p=4:\shap=59:\sp=2:\l=2 ; red up
- Wend
- EndIf
-
- If complete=1
- If FirstItem(stf())=-1
- USEPATH stf()
- While NextItem(stf())=-1
- If \l=1 OR \l=3 OR \l=5
- \typ=4:\sp=16:\l=7
- If \p=1 Then \shap=87:If \p=2 Then \shap=85
- EndIf
- If \l=2 OR \l=4 OR \l=6
- \typ=4:\sp=16:\l=8
- If \p=3 Then \shap=88:If \p=4 Then \shap=86
- EndIf
- Wend
- EndIf
- EndIf
-
- If level=1 Then time=4000
- If level=2 Then time=2500
- If level=3 Then time=3000
- If level=4 Then time=3000
- If level=5 Then time=4000
- If level=6 Then time=3500
- If level=7 Then time=4500
- If level=8 Then time=4000
- If level=9 Then time=3000
- If level=10 Then time=2500
- If level=11 Then time=4500
- If level=12 Then time=3000
- If level=13 Then time=3000
- If level=14 Then time=3000
- If level=15 Then time=3750
- If level=16 Then time=2250
- If level=17 Then time=3000
- If level=18 Then time=2000
- If level=19 Then time=3750
- If level=20 Then time=5000
- If level=21 Then time=3000
- If level=22 Then time=3000
- If level=23 Then time=3000
- If level=24 Then time=3000
- If level=25 Then time=3000
- If level=26 Then time=3000
- If level=27 Then time=3000
- If level=28 Then time=4000
- If level=29 Then time=3000
- If level=30 Then time=4500
- If level=31 Then time=4500
- If level=32 Then time=3000
- If level=33 Then time=3500
- If level=34 Then time=3000
- If level=35 Then time=3000
- If level=36 Then time=3000
- If level=37 Then time=4000
- If level=38 Then time=3000
- If level=39 Then time=3000
- If level=40 Then time=3750
- If level=41 Then time=3750
- If level=42 Then time=3000
- If level=43 Then time=3500
- If level=44 Then time=3500
- If level=45 Then time=3500
- If level=46 Then time=3500
- If level=47 Then time=3500
- If level=48 Then time=3500
- If level=49 Then time=3000
- If level=50 Then time=4500
-
- If FirstItem(blk())=-1
- USEPATH blk()
- While NextItem(blk())=-1
- If \shap=6 Then px=\x:py=\y ; find starting position
- Wend
- EndIf
-
- VWait 100:BLITZ:BlitzKeys On:BitMapOutput 2:Colour 1
- CreateDisplay 1,0
- DisplayPalette 0,0:DisplayPalette 1,0
- Use BitMap 2:Blit 100,2,2:Free BitMap 4
-
- ; *** START OF MAIN LOOP ***
-
- .mainloop
-
- Repeat
-
- VWait ; Display game screen
- DisplayBitMap 0,db,scrollx,scrolly:DisplayBitMap 1,2:db=1-db:Use BitMap db:UnBuffer db
-
- jx=Joyx(1)
- jy=Joyy(1)
- jb=Joyb(1)
-
- Gosub checkitems
- Gosub checkcontrols
- Gosub checkstatus
- Gosub checkcoll
-
- BBlit db,p,px,py
-
- time=time-2
-
- If cheat=1
- If RawStatus($21) Then gems=0:Sound 0,8:Goto nextlev ; skip level
- If RawStatus($28) Then lives=lives+1 ; extra life
- If RawStatus($25) Then health=health+1 ; extra health
- If RawStatus($27) Then health=0 ; er, kill yourself
- EndIf
-
- Until RawStatus($45):score=-1:Goto gameover
-
- ; *** END OF MAIN LOOP ***
-
- .checkitems
-
- If FirstItem(blk())=-1
- USEPATH blk()
- While NextItem(blk())=-1
- UnBuffer db
- If NOT \x<scrollx OR \y<scrolly OR \x=>scrollx+330 OR \y=>scrolly+220
- If \shap=0 Then BBlit db,0,\x,\y
- If \shap=1 Then BBlit db,93,\x,\y ; gem
- If \shap=2 Then BBlit db,94,\x,\y ; key
- If \shap=3 Then BBlit db,95,\x,\y ; extra life
- If \shap=4 Then BBlit db,96,\x,\y ; pts
- If \shap=5 Then BBlit db,97,\x,\y ; health
- If \shap=7 Then BBlit db,98,\x,\y ; door horiz
- If \shap=8 Then BBlit db,99,\x,\y ; door vert
- If \shap=70 Then BBlit db,7,\x,\y
- If \shap=80 Then BBlit db,8,\x,\y
- If ShapesHit(p,px,py,\shap,\x,\y)
- If \shap=1 Then \shap=0:gems=gems-1:gemcoll=gemcoll+1:Sound 3,8:score=score+5:If gems<1 Then Sound 10,8
- If \shap=2 Then \shap=0:keys=keys+1:Sound 6,8:score=score+2
- If \shap=3 Then \shap=0:lives=lives+1:Sound 7,8
- If \shap=4 Then \shap=0:score=score+100:Sound 8,8
- If \shap=5 Then \shap=0:health=health+1:Sound 4,8
- EndIf
- If ShapesHit(51,px,py,98,\x,\y) OR ShapesHit(49,px+4,py,98,\x,\y)
- If keys=0 AND p=51 AND \shap=7 Then px=px+4:If px>180 AND scrollx<320 Then scrollx=scrollx+4
- If keys=0 AND p=49 AND \shap=7 Then px=px-4:If px>180 AND scrollx>0 Then scrollx=scrollx-4
- If keys>0 AND \shap=7 Then \shap=70:keys=keys-1:Sound 9,8
- If ShapesHit(50,px,py,99,\x,\y) OR ShapesHit(52,px,py+4,99,\x,\y)
- If keys=0 AND p=50 AND \shap=8 Then py=py+4:If py>160 AND scrolly<300 Then scrolly=scrolly+4
- If keys=0 AND p=52 AND \shap=8 Then py=py-4:If py>160 AND scrolly>0 Then scrolly=scrolly-4
- If keys>0 AND \shap=8 Then \shap=80:keys=keys-1:Sound 9,8
- EndIf
- EndIf
- EndIf
- Buffer db,16384
- Wend
- EndIf
-
- Return
-
- .checkcontrols
-
- UnBuffer db
-
- If RawStatus($4c) Then jy=-1
- If RawStatus($4d) Then jy=1
- If RawStatus($4f) Then jx=-1
- If RawStatus($4e) Then jx=1
- If RawStatus($40) Then jb=1
-
- If jx=-1 AND px>0 ; left
- p=51
- px=px-4
- If px>180 AND scrollx>0 Then scrollx=scrollx-4
- EndIf
-
- If jx=1 AND px<620 ; right
- p=49
- px=px+4
- If px>180 AND scrollx<320 Then scrollx=scrollx+4
- EndIf
-
- If jy=-1 AND py>0 ; up
- p=50
- py=py-4
- If py>160 AND scrolly>0 Then scrolly=scrolly-4
- EndIf
-
- If jy=1 AND py<500 ; down
- p=52
- py=py+4
- If py>160 AND scrolly<300 Then scrolly=scrolly+4
- EndIf
-
- If jx=-1 AND jy=-1 Then p=53 ; up-left
- If jx=-1 AND jy=1 Then p=55 ; up-right
- If jx=1 AND jy=-1 Then p=54 ; down-left
- If jx=1 AND jy=1 Then p=56 ; down-right
-
- Buffer db,16384
-
- Return
-
- .checkstatus
-
- Format "#0":Locate 3,2.4:NPrint gems
- Format "#0":Locate 8,2.4:NPrint keys
- Format "#0":Locate 13,2.4:NPrint lives
- Format "#0":Locate 17,2.4:NPrint health
- Format "#0":Locate 24,2.4:NPrint level
- Format "######0":Locate 31,2.4:NPrint score
- Format "0":Locate 27,1:NPrint "TIME - "+Str$(Int(time/3000))+":"
- Format "00":Locate 36,1:NPrint Str$(Int(temp))
- temp=Int(time/50)
- If temp>60
- Repeat
- temp-60
- Until temp<60
- EndIf
-
- If temp=60 Then temp=0
- If lives<0 Then Goto gameover
-
- If health=0 OR time=0
- px=sx:py=sy:lives=lives-1:liveslost=liveslost+1
- Sound 1,8:p=48
- scrollx=0:scrolly=0
- health=3
- If time=0 Then time=3000:timelost=1
- EndIf
-
- If RawStatus($19) ; pause
- Repeat
- Until Joyb(1)=1 OR RawStatus($40)
- EndIf
-
- Return
-
- .checkcoll
-
- If FirstItem(stf())=-1
- USEPATH stf()
- While NextItem(stf())=-1
- If \typ>0 Then BBlit db,\shap,\ex,\ey
- If NOT \x<scrollx OR \y<scrolly OR \x=>scrollx+330 OR \y=>scrolly+220
- If ShapesHit(p,px,py,\shap,\x,\y)
- If \shap=9 Then health=0 ; if collide with black space then death!
- If ShapesHit(p,px,py,\shap,\x,\y) AND p=50 AND \shap=12 Then py=py-4:If py>160 AND scrolly>0 Then scrolly=scrolly-4
- If ShapesHit(p,px,py,\shap,\x,\y) AND p=51 AND \shap=12 Then px=px-4:If px>180 AND scrollx>0 Then scrollx=scrollx-4
- If ShapesHit(p,px+4,py,\shap,\x,\y) AND p=49 AND \shap=12 Then px=px+4:If px>180 AND scrollx<320 Then scrollx=scrollx+4
- If ShapesHit(p,px,py+4,\shap,\x,\y) AND p=52 AND \shap=12 Then py=py+4:If py>160 AND scrolly<300 Then scrolly=scrolly+4
- If \shap=13 Then px=px+4:If px>180 AND scrollx<320 Then scrollx=scrollx+4
- If \shap=14 Then py=py-4:If py>160 AND scrolly>0 Then scrolly=scrolly-4
- If \shap=15 Then px=px-4:If px>180 AND scrollx>0 Then scrollx=scrollx-4
- If \shap=16 Then py=py+4:If py>160 AND scrolly<300 Then scrolly=scrolly+4
- If \shap=10 OR \shap=11 AND gems=0:Sound 0,8:Goto nextlev:EndIf ; if exit
- EndIf
- ; collision with walls
- If ShapesHit(51,px,py,\shap,\x,\y) AND \shap=>17 AND \shap=<31 Then px=px+4:If scrollx<320 AND px>180 Then scrollx=scrollx+4
- If ShapesHit(49,px+2,py,\shap,\x,\y) AND \shap=>17 AND \shap=<31 Then px=px-4:If scrollx>0 AND px>180 Then scrollx=scrollx-4
- If ShapesHit(50,px,py,\shap,\x,\y) AND \shap=>17 AND \shap=<31 Then py=py+4:If scrolly<300 AND py>160 Then scrolly=scrolly+4
- If ShapesHit(52,px,py+2,\shap,\x,\y) AND \shap=>17 AND \shap=<31 Then py=py-4:If scrolly>0 AND py>160 Then scrolly=scrolly-4
- EndIf
- ; move enemies
- If \l=1
- If \p=1 Then \shap=60:If \p=2 Then \shap=58
- If \p=1 AND \ex>8 Then \ex=\ex-\sp Else \ex=\ex+\sp:\p=2
- If \p=2 AND \ex<620 Then \ex=\ex+\sp Else \ex=\ex-\sp:\p=1
- EndIf
- If \l=2
- If \p=3 Then \shap=61:If \p=4 Then \shap=59
- If \p=3 AND \ey<496 Then \ey=\ey+\sp Else \ey=\ey-\sp:\p=4
- If \p=4 AND \ey>8 Then \ey=\ey-\sp:Else \ey=\ey+\sp:\p=3
- EndIf
- If \l=3
- If \p=1 Then \shap=69:If \p=2 Then \shap=67
- If \p=1 AND \ex>8 Then \ex=\ex-\sp Else \ex=\ex+\sp:\p=2
- If \p=2 AND \ex<620 Then \ex=\ex+\sp Else \ex=\ex-\sp:\p=1
- EndIf
- If \l=4
- If \p=3 Then \shap=70:If \p=4 Then \shap=68
- If \p=3 AND \ey<496 Then \ey=\ey+\sp Else \ey=\ey-\sp:\p=4
- If \p=4 AND \ey>8 Then \ey=\ey-\sp:Else \ey=\ey+\sp:\p=3
- EndIf
- If \l=5
- If \p=1 Then \shap=78:If \p=2 Then \shap=76
- If \p=1 AND \ex>8 Then \ex=\ex-\sp Else \ex=\ex+\sp:\p=2
- If \p=2 AND \ex<620 Then \ex=\ex+\sp Else \ex=\ex-\sp:\p=1
- EndIf
- If \l=6
- If \p=3 Then \shap=79:If \p=4 Then \shap=77
- If \p=3 AND \ey<496 Then \ey=\ey+\sp Else \ey=\ey-\sp:\p=4
- If \p=4 AND \ey>8 Then \ey=\ey-\sp:Else \ey=\ey+\sp:\p=3
- EndIf
- If \l=7
- If \p=1 Then \shap=87:If \p=2 Then \shap=85
- If \p=1 AND \ex>33 Then \ex=\ex-\sp Else \ex=\ex+\sp:\p=2
- If \p=2 AND \ex<620 Then \ex=\ex+\sp Else \ex=\ex-\sp:\p=1
- EndIf
- If \l=8
- If \p=3 Then \shap=88:If \p=4 Then \shap=86
- If \p=3 AND \ey<496 Then \ey=\ey+\sp Else \ey=\ey-\sp:\p=4
- If \p=4 AND \ey>33 Then \ey=\ey-\sp:Else \ey=\ey+\sp:\p=3
- EndIf
- ; collision with enemies
- If ShapesHit(p,px,py,\shap,\ex,\ey)
- If \shap=>32 Then health=health-1:healthlost=healthlost+1
- Sound 5,8
- EndIf
- Wend
- EndIf
-
- Return
-
- .nextlev
-
- QAMIGA:Use BitMap 3:Cls:BLITZ
- score=score+50:keys=0
- DisplayBitMap 0,3,0,0:DisplayPalette 0,0
- Use BitMap 0:Cls:Use BitMap 1:Cls
- UnBuffer 0:UnBuffer 1:UnBuffer db
- BitMapOutput 3:Use BitMap 3:Colour 1
- Locate 0,1:NPrint " LEVEL COMPLETE "
- Locate 0,3:Format "##0":NPrint "GEM BONUS ",gemcoll:score=score+gemcoll
- Locate 0,4:NPrint "LEVEL BONUS 50"
- If timelost=0
- Locate 0,5:Format "##0":NPrint "TIME BONUS "+Str$(Int(time/50)):score=score+(time/50)
- EndIf
- If liveslost=0 AND healthlost=0
- Locate 0,6:NPrint "NO HARM DONE BONUS 125":score=score+125
- EndIf
- If level=10 OR level=20 OR level=30 OR level=40 OR level=50
- Locate 0,7:NPrint "WORLD BONUS 200":score=score+200
- EndIf
- If level=5 OR level=10 OR level=15 OR level=20 OR level=25 OR level=30 OR level=35 OR level=40 OR level=45
- BlitzKeys On:done=0:Format "0"
- While NOT RawStatus($15) OR RawStatus($36):Locate 0,20:NPrint " SAVE GAME? (Y or N) ":Wend
- If RawStatus($15)
- Repeat
- Locate 0,22:NPrint " GAME NUMBER? 1 to 9 "
- If RawStatus($01) Then sav=1:Gosub savegame
- If RawStatus($02) Then sav=2:Gosub savegame
- If RawStatus($03) Then sav=3:Gosub savegame
- If RawStatus($04) Then sav=4:Gosub savegame
- If RawStatus($05) Then sav=5:Gosub savegame
- If RawStatus($06) Then sav=6:Gosub savegame
- If RawStatus($07) Then sav=7:Gosub savegame
- If RawStatus($08) Then sav=8:Gosub savegame
- If RawStatus($09) Then sav=9:Gosub savegame
- Until RawStatus($36) OR done=1
- EndIf
- EndIf
- If level=50
- Locate 14,22:NPrint "PRESS FIRE"
- Repeat:Until Joyb(1)=1 OR RawStatus($40)
- EndIf
- Format "0":level=level+1:If level>9 Then Format "00"
- QAMIGA
- For n=0 To 47
- Free Shape n
- Next n
- Free BitMap 0:Free BitMap 1
- scrollx=0:scrolly=0
- If LastItem(blk())
- USEPATH blk()
- While PrevItem(blk())
- \shap=0:\x=0:\y=0
- KillItem blk()
- Wend
- EndIf
- If FirstItem(blk())
- USEPATH blk()
- \shap=0:\x=0:\y=0
- KillItem blk()
- EndIf
- If LastItem(stf())
- USEPATH stf()
- While PrevItem(stf())
- \shap=0:\x=0:\y=0:\p=0:\typ=0:\l=0:\ex=0:\ey=0:\sp=0
- KillItem stf()
- Wend
- EndIf
- If FirstItem(stf())
- USEPATH stf()
- While NextItem(stf())
- \shap=0:\x=0:\y=0:\p=0:\typ=0:\l=0:\ex=0:\ey=0:\sp=0
- KillItem stf()
- Wend
- EndIf
- ClearList blk():ClearList stf()
- If level>#maxlevels Then Goto finish
- Goto setup
-
- .gameover
-
- QAMIGA:Use BitMap 3:Cls:Blit 102,82,88:BLITZ
- DisplayBitMap 0,3,0,0:DisplayPalette 0,0
- Sound 2,8
- If cheat=1 Then score=-1
- Repeat
- Until Joyb(1)=1 OR RawStatus($40)
- CreateDisplay 2:DisplayBitMap 2,5:DisplayPalette 2,0
- If LastItem(blk())
- USEPATH blk()
- While PrevItem(blk())
- \shap=0:\x=0:\y=0
- KillItem blk()
- Wend
- EndIf
- If FirstItem(blk())
- USEPATH blk()
- \shap=0:\x=0:\y=0
- KillItem blk()
- EndIf
- If LastItem(stf())
- USEPATH stf()
- While PrevItem(stf())
- \shap=0:\x=0:\y=0:\p=0:\typ=0:\l=0:\ex=0:\ey=0:\sp=0
- KillItem stf()
- Wend
- EndIf
- If FirstItem(stf())
- USEPATH stf()
- While NextItem(stf())
- \shap=0:\x=0:\y=0:\p=0:\typ=0:\l=0:\ex=0:\ey=0:\sp=0
- KillItem stf()
- Wend
- EndIf
- ClearList blk():ClearList stf()
- If score>highpoints(9)
- Sound 11,8
- DisplayBitMap 2,3:DisplayPalette 2,0:BitMapOutput 3:BlitzKeys On
- Use BitMap 3:Colour 1:BitMapInput
- Locate 0,1:NPrint " CONGRATULATIONS! "
- Locate 0,3:NPrint " You have entered the high score table! "
- Locate 0,4:NPrint " Please enter your name: "
- Locate 10,6:name$=Edit$(20)
- For s=9 To 0 Step -1
- If score=>highpoints(s) Then pos=s
- Next s
- For s=9 To pos Step -1
- If s>0
- highname$(s)=highname$(s-1)
- highpoints(s)=highpoints(s-1)
- EndIf
- Next s
- highname$(pos)=name$
- highpoints(pos)=score
- If name$="I WANT TO CHEAT" AND cheat=0
- Sound 11,8
- Locate 0,31:NPrint " CHEAT MODE ACTIVATED!!! "
- cheat=1
- Repeat
- Until Joyb(1)=1 OR RawStatus($40)
- EndIf
- QAMIGA
- suc=OpenFile(0,"Data/highscores")
- Fields 0,highname$(0)
- Fields 0,highname$(1)
- Fields 0,highname$(2)
- Fields 0,highname$(3)
- Fields 0,highname$(4)
- Fields 0,highname$(5)
- Fields 0,highname$(6)
- Fields 0,highname$(7)
- Fields 0,highname$(8)
- Fields 0,highname$(9)
- Fields 0,highpoints(0)
- Fields 0,highpoints(1)
- Fields 0,highpoints(2)
- Fields 0,highpoints(3)
- Fields 0,highpoints(4)
- Fields 0,highpoints(5)
- Fields 0,highpoints(6)
- Fields 0,highpoints(7)
- Fields 0,highpoints(8)
- Fields 0,highpoints(9)
- Put 0,0
- CloseFile 0
- EndIf
- DisplayBitMap 2,5:DisplayPalette 2,0
- QAMIGA
- Use BitMap 3:Cls
- Goto begin
-
- .savegame
-
- QAMIGA
- levela=level+1
- If level=51 Then levela=1:complete=1
- suc=OpenFile(sav,"Data/savegame"+Str$(sav))
- Fields sav,levela
- Fields sav,health
- Fields sav,lives
- Fields sav,score
- Fields sav,cheat
- Fields sav,complete
- Put sav,0
- CloseFile sav
- done=1
- VWait 50
- BLITZ
-
- Return
-
- .loadgame
-
- QAMIGA
- suc=OpenFile(sav,"Data/savegame"+Str$(sav))
- VWait
- PlayMed
- Fields sav,levela
- Fields sav,health
- Fields sav,lives
- Fields sav,score
- Fields sav,cheat
- Fields sav,complete
- Get sav,0
- CloseFile sav
- done=1
- VWait 50
- BLITZ
-
- Return
-
- .finish
-
- CreateDisplay 2:DisplayBitMap 2,3:DisplayPalette 2,0
- BitMapOutput 3:Use BitMap 3:Colour 1:QAMIGA:Cls:BLITZ
- Format "######0"
- If complete=0 AND cheat=0
- Locate 0,0 :NPrint " CONGRATULATIONS! "
- Locate 0,2 :NPrint " You have completed Blobz. "
- Locate 0,3 :NPrint " Your final score is: ",score
- Locate 0,5 :NPrint " CHEAT MODE! "
- Locate 0,7 :NPrint " On the high score table, type: "
- Locate 0,8 :NPrint " I WANT TO CHEAT "
- Locate 0,9 :NPrint " exactly as it's written above. "
- Locate 0,11:NPrint " Then use the following keys in-game: "
- Locate 0,13:NPrint " S - Skip Level "
- Locate 0,14:NPrint " L - Extra Life "
- Locate 0,15:NPrint " H - Extra Health "
- Locate 0,16:NPrint " K - Kill yourself "
- Locate 0,18:NPrint " BEWARE: If you put the cheat mode on "
- Locate 0,29:NPrint " you will NOT enter the high score "
- Locate 0,20:NPrint " table, regardless of your score. "
- Locate 0,31:NPrint " PRESS FIRE "
- Repeat:Until Joyb(1)=1 OR RawStatus($40)
- QAMIGA:Cls:BLITZ
- Locate 0,14:NPrint " Now your game will be saved. "
- Locate 0,15:NPrint " Load it back in to start again with a "
- Locate 0,16:NPrint " difference... "
- Format "0":Gosub savegame
- Locate 0,31:NPrint " PRESS FIRE "
- Repeat:Until Joyb(1)=1 OR RawStatus($40)
- QAMIGA:Cls:BLITZ
- Goto gameover
- EndIf
-
- If complete=>0 AND cheat=1
- Locate 0,13:NPrint " Your final score is: ",score
- Locate 0,14:NPrint " CHEATER!!!! "
- If complete=0
- Locate 0,15:NPrint " Now your game will be saved. "
- Locate 0,16:NPrint " Load it back in to start again with a "
- Locate 0,17:NPrint " difference... "
- Format "0":Gosub savegame
- EndIf
- Locate 0,31:NPrint " PRESS FIRE "
- Repeat:Until Joyb(1)=1 OR RawStatus($40)
- QAMIGA:Cls:BLITZ
- Goto gameover
- EndIf
-
- If complete=1 AND cheat=0
- Locate 0,13:NPrint " CONGRATULATIONS!! "
- Locate 0,14:NPrint " Your final score is: ",score
- Locate 0,16:NPrint " How the hell did you manage that!?! "
- Locate 0,17:NPrint " You truly are a Blobz master! "
- Locate 0,31:NPrint " PRESS FIRE "
- Repeat:Until Joyb(1)=1 OR RawStatus($40)
- QAMIGA:Cls:BLITZ
- Goto gameover
- EndIf
-
- .cleanup
-
- AMIGA
-
- StopMed
- Free MedModule 0
-
- For n=0 To 101
- Free Shape n
- Next n
-
- For n=0 To 3
- Free BitMap n
- Next n
-
- For n=0 To 2
- Free CopList n
- Next n
-
- For n=0 To 10
- Free Sound n
- Next n
-
- Free Palette 0
-
- End
-